package com.wjj.happytime.adapter.happy_frg_adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.wjj.happytime.entity.happy_entity.TypeEntity;
import com.wjj.happytime.fragment.happy_frg.CommonHappyFrg;

import java.util.LinkedList;

/**
 * created by Wang_JunJie at 2017/1/9
 */
public class HappyFrgViewPagerAdapter extends FragmentStatePagerAdapter {
    private LinkedList<TypeEntity> tabs;
    public HappyFrgViewPagerAdapter(FragmentManager fm,LinkedList<TypeEntity> tabs) {
        super(fm);
        this.tabs=tabs;
    }

    @Override
    public Fragment getItem(int position) {
        Fragment frg=CommonHappyFrg.getInstance(tabs.get(position).getType());
        return frg;
    }

    @Override
    public int getCount() {
        return tabs.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabs.get(position).getTitle();
    }




}
